Add TAL-Reverb-II plugin to test
[juce-lv2.git] / juce / source / extras / audio plugin host / Source / HostStartup.cpp
blobb85777384f9de4b49532bcc12a866d5e1bce3b82
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-9 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #include "../JuceLibraryCode/JuceHeader.h"
27 #include "MainHostWindow.h"
28 #include "InternalFilters.h"
30 #if ! (JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_AU)
31 #error "If you're building the audio plugin host, you probably want to enable VST and/or AU support in juce_Config.h"
32 #endif
35 ApplicationCommandManager* commandManager = 0;
38 //==============================================================================
39 class PluginHostApp : public JUCEApplication
41 public:
42 //==============================================================================
43 PluginHostApp()
47 ~PluginHostApp()
51 void initialise (const String& commandLine)
53 // initialise our settings file..
55 PropertiesFile::Options options;
56 options.applicationName = "Juce Audio Plugin Host";
57 options.filenameSuffix = "settings";
58 options.osxLibrarySubFolder = "Preferences";
60 ApplicationProperties::getInstance()->setStorageParameters (options);
62 commandManager = new ApplicationCommandManager();
64 AudioPluginFormatManager::getInstance()->addDefaultFormats();
65 AudioPluginFormatManager::getInstance()->addFormat (new InternalPluginFormat());
67 mainWindow = new MainHostWindow();
68 //mainWindow->setUsingNativeTitleBar (true);
70 commandManager->registerAllCommandsForTarget (this);
71 commandManager->registerAllCommandsForTarget (mainWindow);
73 mainWindow->menuItemsChanged();
75 if (commandLine.isNotEmpty() && mainWindow->getGraphEditor() != 0)
77 #if JUCE_MAC
78 if (! commandLine.trimStart().startsWith ("-psn"))
79 #endif
80 mainWindow->getGraphEditor()->graph.loadFrom (File::getCurrentWorkingDirectory()
81 .getChildFile (commandLine), true);
85 void shutdown()
87 mainWindow = 0;
88 ApplicationProperties::getInstance()->closeFiles();
90 deleteAndZero (commandManager);
93 void systemRequestedQuit()
95 if (mainWindow != 0)
96 mainWindow->tryToQuitApplication();
97 else
98 JUCEApplication::quit();
101 const String getApplicationName() { return "Juce Plug-In Host"; }
102 const String getApplicationVersion() { return ProjectInfo::versionString; }
103 bool moreThanOneInstanceAllowed() { return true; }
105 private:
106 ScopedPointer <MainHostWindow> mainWindow;
110 // This kicks the whole thing off..
111 START_JUCE_APPLICATION (PluginHostApp)